package algorithmTopics.array;

import java.util.Arrays;

public class test4 {

    public static void main(String[] args) {
        test4 test4 = new test4();
        System.out.println(test4.containsDuplicate(new int[]{1, 2, 3}));
    }


    public boolean containsDuplicate(int[] nums) {
        //排序一下
        Arrays.sort(nums);
        for (int i = 0; i < nums.length -1; i++) {
                if (nums[i] == nums[i+1]) {
                    return true;
                }
        }
        return false;
    }
}
